package com.gxa.controller.basic_commodity_settings;

import com.gxa.common.Constants;
import com.gxa.common.PaginationResult;
import com.gxa.common.ResponseData;
import com.gxa.pojo.*;
import com.gxa.service.StoneService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: zxy
 * Date: 2020/10/27 11:43
 * Description:石料基础设置
 * Version: V1.0
 */
@RestController
@RequestMapping("stone")
@Api(value = "石料基础设置",tags = "石料基础信息设置")
public class SfdsController {

    @Autowired(required = false)
    private StoneService stoneService;
    @Autowired
    private ResponseData responseData;
    /**
     * 石料种类
     * @return
     */
    @GetMapping(value = "/queryStoneStyle")
    @ApiOperation(value = "查询石料种类",notes = "查询对应的石料种类信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryStoneStyle(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        ResponseData responseData = new ResponseData();
        PaginationResult paginationResult = stoneService.queryStoneType(currentPage,pageSize);
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("查询成功");
        responseData.setData(paginationResult);
        return responseData;
    }

    @PostMapping(value = "/updateStoneStyle")
    @ApiOperation(value = "修改石料种类",notes = "根据返回的值修改对应的石料种类信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateStoneStyle(@RequestBody @ApiParam(name = "stoneType",value = "石料种类") StoneType stoneType){
        ResponseData responseData = new ResponseData();
        int result = stoneService.updateStoneStyle(stoneType);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(null);
        }
        return responseData;
    }

    @PostMapping(value = "/delStoneStyle")
    @ApiOperation(value = "删除石料种类",notes = "根据页面返回的值删除对应的石料种类信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delStoneStyle(@RequestBody @ApiParam(name = "typeId",value = "石料种类id")StoneType stoneType){
        ResponseData responseData = new ResponseData();
        int result = stoneService.delStoneStyle(stoneType.getTypeId());
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
            responseData.setData(null);
        }
        return responseData;
    }

    @PostMapping(value = "/addStoneStyle")
    @ApiOperation(value = "添加石料种类",notes = "根据页面返回的值添加对应的石料种类信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addStoneStyle(@RequestBody @ApiParam(name = "stoneType",value = "石料种类") StoneType stoneType){
        ResponseData responseData = new ResponseData();
        System.out.println(stoneType.getStoneName());
        int result = stoneService.addStoneStyle(stoneType);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(null);
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("添加失败");
            responseData.setData(null);
        }
        return responseData;
    }

    /**
     * 石料颜色
     * @return
     */
    @GetMapping(value = "/queryStoneColor")
    @ApiOperation(value = "查询石料颜色",notes = "查询对应的石料颜色信息",httpMethod = "Get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryStoneColor(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        ResponseData responseData = new ResponseData();
        PaginationResult paginationResult = stoneService.queryStoneColor(currentPage,pageSize);
        if(paginationResult != null){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("查询成功");
            responseData.setData(paginationResult);
        }
        return responseData;
    }

    @PostMapping(value = "/updateStoneColor")
    @ApiOperation(value = "修改石料颜色",notes = "根据返回的值修改对应的石料种类信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateStoneColor(@RequestBody @ApiParam(name = "stoneColor",value = "石料颜色") StoneColor stoneColor){
        ResponseData responseData = new ResponseData();
        int result = stoneService.updateStoneColor(stoneColor);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("修改失败");
        }
        return responseData;
    }

    @PostMapping(value = "/delStoneColor")
    @ApiOperation(value = "删除石料颜色",notes = "根据页面返回的值删除对应的石料颜色信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delStoneColor(@RequestBody @ApiParam(name = "colorId",value = "石料颜色id") StoneColor stoneColor){
        ResponseData responseData = new ResponseData();
        int result = stoneService.delStoneColor(stoneColor.getColorId());
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("删除失败");
        }
        return responseData;
    }

    @PostMapping(value = "/addStoneColor")
    @ApiOperation(value = "添加石料颜色",notes = "根据页面返回的值添加对应的石料颜色信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addStoneColor(@RequestBody @ApiParam(name = "stoneColor",value = "石料颜色") StoneColor stoneColor){
        ResponseData responseData = new ResponseData();
        int result = stoneService.addStoneColor(stoneColor);
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("添加成功");
        return responseData;
    }

    /**
     * 石料净度
     * @return
     */
    @GetMapping(value = "/queryStoneClarity")
    @ApiOperation(value = "查询石料净度",notes = "查询对应的石料净度信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryStoneClarity(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        ResponseData responseData = new ResponseData();
        PaginationResult paginationResult = stoneService.queryStoneClarity(currentPage,pageSize);
        if(paginationResult != null){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("查询成功");
            responseData.setData(paginationResult);
        }
        return responseData;
    }

    @PostMapping(value = "/updateStoneClarity")
    @ApiOperation(value = "修改石料净度",notes = "根据返回的值修改对应的石料净度信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateStoneClarity(@RequestBody @ApiParam(name = "stoneClarity",value = "石料净度") StoneClarity stoneClarity){
        int result = stoneService.updateStoneClarity(stoneClarity);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(stoneClarity);
        }
        return responseData;
    }

    @PostMapping(value = "/delStoneClarity")
    @ApiOperation(value = "删除石料净度",notes = "根据页面返回的值删除对应的石料净度信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delStoneClarity(@RequestBody @ApiParam(name = "clarityId",value = "石料净度id") StoneClarity stoneClarity){
        int result = stoneService.delStoneClarity(stoneClarity.getClarityId());
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("删除失败");
        }
        return responseData;
    }

    @PostMapping(value = "/addStoneClarity")
    @ApiOperation(value = "添加石料净度",notes = "根据页面返回的值添加对应的石料净度信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addStoneClarity(@RequestBody @ApiParam(name = "stoneClarity",value = "石料净度")StoneClarity stoneClarity){
        int result = stoneService.addStoneClarity(stoneClarity);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(stoneClarity);
        }
        return responseData;
    }

    /**
     * 石料切工
     * @return
     */
    @GetMapping(value = "/queryStoneCut")
    @ApiOperation(value = "查询石料切工",notes = "查询对应的石料切工信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryStoneCut(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = stoneService.queryStoneCut(currentPage,pageSize);
        if(paginationResult != null){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("查询成功");
            responseData.setData(paginationResult);
        }
        return responseData;
    }

    @PostMapping(value = "/updateStoneCut")
    @ApiOperation(value = "修改石料切工",notes = "根据返回的值修改对应的石料切工信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateStoneCut(@RequestBody @ApiParam(name = "stoneCut",value = "石料切工") StoneCut stoneCut){
        int result = stoneService.updateStoneCut(stoneCut);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(stoneCut);
        }
        return responseData;
    }

    @PostMapping(value = "/delStoneCut")
    @ApiOperation(value = "删除石料切工",notes = "根据页面返回的值删除对应的石料切工信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delStoneCut(@RequestBody @ApiParam(name = "cutId",value = "石料切工id")StoneCut stoneCut){
        int result = stoneService.delStoneCut(stoneCut.getCutId());
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }
        return responseData;
    }

    @PostMapping(value = "/addStoneCut")
    @ApiOperation(value = "添加石料切工",notes = "根据页面返回的值添加对应的石料切工信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addStoneCut(@RequestBody @ApiParam(name = "stoneCut",value = "石料切工")StoneCut stoneCut){
        int result = stoneService.addStoneCut(stoneCut);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(stoneCut);
        }
        return responseData;
    }

    /**
     * 石料火彩
     * @return
     */
    @GetMapping(value = "/queryStoneSci")
    @ApiOperation(value = "查询石料火彩",notes = "查询对应的石料火彩信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryStoneSci(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = stoneService.queryStoneSci(currentPage,pageSize);
        if(paginationResult != null){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("查询成功");
            responseData.setData(paginationResult);
        }else{
            responseData.setCode(Constants.NOTFOUND);
            responseData.setMsg("没有找到相关的信息");
        }
        return responseData;
    }

    @PostMapping(value = "/updateStoneSci")
    @ApiOperation(value = "修改石料火彩",notes = "根据返回的值修改对应的石料火彩信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateStoneSci(@RequestBody @ApiParam(name = "stoneSci",value = "石料火彩") StoneSci stoneSci){
        int result = stoneService.updateStoneSci(stoneSci);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(stoneSci);
        }
        return responseData;
    }

    @PostMapping(value = "/delStoneSci")
    @ApiOperation(value = "删除石料火彩",notes = "根据页面返回的值删除对应的石料火彩信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delStoneSci(@RequestBody @ApiParam(name = "sciId",value = "石料火彩id")StoneSci stoneSci){
        int result = stoneService.delStoneSci(stoneSci.getSciId());
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }
        return responseData;
    }

    @PostMapping(value = "/addStoneSci")
    @ApiOperation(value = "添加石料火彩",notes = "根据页面返回的值添加对应的石料火彩信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addStoneSci(@RequestBody @ApiParam(name = "stoneSci",value = "石料火彩")StoneSci stoneSci){
        int result = stoneService.addStoneSci(stoneSci);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(stoneSci);
        }
        return responseData;
    }

    /**
     * 石料形状信息
     * @return
     */
    @GetMapping(value = "/queryStoneShape")
    @ApiOperation(value = "查询石料形状",notes = "查询对应的石料形状信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryStoneShape(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = stoneService.queryStoneShape(currentPage,pageSize);
        if(paginationResult != null){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("查询成功");
            responseData.setData(paginationResult);
        }
        return responseData;
    }

    @PostMapping(value = "/updateStoneShape")
    @ApiOperation(value = "修改石料形状",notes = "根据返回的值修改对应的石料形状信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateStoneShape(@RequestBody @ApiParam(name = "stoneShape",value = "石料形状")StoneShape stoneShape){
        int result = stoneService.updateStoneShape(stoneShape);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(stoneShape);
        }
        return responseData;
    }

    @PostMapping(value = "/delStoneShape")
    @ApiOperation(value = "删除石料形状",notes = "根据页面返回的值删除对应的石料形状信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delStoneShape(@RequestBody @ApiParam(name = "shapeId",value = "石料形状id") StoneShape stoneShape){
        int result = stoneService.delStoneShape(stoneShape.getShapeId());
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }
        return responseData;
    }

    @PostMapping(value = "/addStoneShape")
    @ApiOperation(value = "添加石料形状",notes = "根据页面返回的值添加对应的石料形状信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addStoneShape(@RequestBody @ApiParam(name = "stoneShape",value = "石料形状") StoneShape stoneShape){
        int result = stoneService.addStoneShape(stoneShape);
        if(result > 0) {
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(stoneShape);
        }
        return responseData;
    }

    /**
     * 石料规格信息
     * @return
     */
    @GetMapping(value = "/queryStoneShapeNorms")
    @ApiOperation(value = "查询石料规格",notes = "查询对应的石料规格信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryStoneNorms(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = stoneService.queryStoneNorms(currentPage,pageSize);
        if(paginationResult != null){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("查询成功");
            responseData.setData(paginationResult);
        }
        return responseData;
    }

    @PostMapping(value = "/updateStoneNorms")
    @ApiOperation(value = "修改石料规格",notes = "根据返回的值修改对应的石料规格信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateStoneNorms(@RequestBody @ApiParam(name = "stoneNorms",value = "石料规格") StoneNorms stoneNorms){
        int result = stoneService.updateStoneNorms(stoneNorms);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(stoneNorms);
        }
        return responseData;
    }

    @PostMapping(value = "/delStoneNorms")
    @ApiOperation(value = "删除石料规格",notes = "根据页面返回的值删除对应的石料规格信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delStoneNorms(@RequestBody @ApiParam(name = "normsId",value = "石料规格id") StoneNorms stoneNorms){
        int result = stoneService.delStoneNorms(stoneNorms.getNormsId());
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }
        return responseData;
    }

    @PostMapping(value = "/addStoneNorms")
    @ApiOperation(value = "添加石料规格",notes = "根据页面返回的值添加对应的石料规格信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addStoneNorms(@RequestBody @ApiParam(name = "stoneNorms",value = "石料规格") StoneNorms stoneNorms){
        int result = stoneService.addStoneNorms(stoneNorms);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(stoneNorms);
        }
        return responseData;
    }

    /**
     * 石料质地信息
     * @return
     */
    @GetMapping(value = "/queryStoneTexture")
    @ApiOperation(value = "查询石料质地",notes = "查询对应的石料质地信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryStoneTexture(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = stoneService.queryStoneTexture(currentPage,pageSize);
        if(paginationResult != null){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("查询成功");
            responseData.setData(paginationResult);
        }
        return responseData;
    }

    @PostMapping(value = "/updateStoneTexture")
    @ApiOperation(value = "修改石料质地",notes = "根据返回的值修改对应的石料质地信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateStoneTexture(@RequestBody @ApiParam(name = "stoneTexture",value = "石料质地") StoneTexture stoneTexture){
        int result = stoneService.updateStoneTexture(stoneTexture);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(stoneTexture);
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("修改失败");
        }
        return responseData;
    }

    @PostMapping(value = "/delStoneTexture")
    @ApiOperation(value = "删除石料质地",notes = "根据页面返回的值删除对应的石料质地信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delStoneTexture(@RequestBody @ApiParam(name = "textureId",value = "石料质地id") StoneTexture stoneTexture){
        int result = stoneService.delStoneTexture(stoneTexture.getTextureId());
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }
        return responseData;
    }

    @PostMapping(value = "/addStoneTexture")
    @ApiOperation(value = "添加石料质地",notes = "根据页面返回的值添加对应的石料质地信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addStoneTexture(@RequestBody @ApiParam(name = "stoneTexture",value = "石料质地") StoneTexture stoneTexture){
        int result = stoneService.addStoneTexture(stoneTexture);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(stoneTexture);
        }
        return responseData;
    }

    /**
     * 石料水头信息
     * @return
     */
    @GetMapping(value = "/queryStoneShapeHead")
    @ApiOperation(value = "查询石料水头",notes = "查询对应的石料水头信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryStoneHead(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = stoneService.queryStoneHead(currentPage,pageSize);
        if(paginationResult != null){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("查询成功");
            responseData.setData(paginationResult);
        }
        return responseData;
    }

    @PostMapping(value = "/updateStoneHead")
    @ApiOperation(value = "修改石料水头",notes = "根据返回的值修改对应的石料水头信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateStoneHead(@RequestBody @ApiParam(name = "stoneHead",value = "石料水头") StoneHead stoneHead){
        int result = stoneService.updateStoneHead(stoneHead);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(stoneHead);
        }
        return responseData;
    }

    @PostMapping(value = "/delStoneHead")
    @ApiOperation(value = "删除石料水头",notes = "根据页面返回的值删除对应的石料水头信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delStoneHead(@RequestBody @ApiParam(name = "headId",value = "石料水头id") StoneHead stoneHead){
        int result = stoneService.delStoneHead(stoneHead);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }
        return responseData;
    }

    @PostMapping(value = "/addStoneHead")
    @ApiOperation(value = "添加石料水头",notes = "根据页面返回的值添加对应的石料水头信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addStoneHead(@RequestBody @ApiParam(name = "stoneHead",value = "石料水头") StoneHead stoneHead){
        int result = stoneService.addStoneHead(stoneHead);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(stoneHead);
        }
        return responseData;
    }
}
